﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
namespace WorldGoldenPrice
{
    public class GoldenPrice
    {

        protected string _LinkService;
        protected string _WorldBuy;
        protected string _WorldSell;
        protected string _Provider;
        protected string _VnBuy;
        protected string _VnSell;
        protected string _OilBuy;
        protected string _OilSell;
        protected string _EURUSD;
        protected string _GBPUSD;
        protected string _USDJPY;
        protected string _USDCAD;
        protected string _AUDUSD;
        protected string _NZDUSD;
        protected string _USDNOK;

        public bool flag = false;


        public string EURUSD
        {
            get { return _EURUSD; }
            set { _EURUSD = value; }
        }


        public string GBPUSD
        {
            get { return _GBPUSD; }
            set { _GBPUSD = value; }
        }

        public string USDJPY
        {
            get { return _USDJPY; }
            set { _USDJPY = value; }
        }

        public string USDCAD
        {
            get { return _USDCAD; }
            set { _USDCAD = value; }
        }

        public string AUDUSD
        {
            get { return _AUDUSD; }
            set { _AUDUSD = value; }
        }

        public string NZDUSD
        {
            get { return _NZDUSD; }
            set { _NZDUSD = value; }
        }

        public string USDNOK
        {
            get { return _USDNOK; }
            set { _USDNOK = value; }
        }

        public string OilBuy
        {
            get { return _OilBuy; }
            set { _OilBuy = value; }
        }

        public string OilSell
        {
            get { return _OilSell; }
            set { _OilSell = value; }
        }
        
        
        public string LinkService
        {
            get { return _LinkService; }
            set { _LinkService = value; }
        }

        public string VnBuy
        {
            get { return _VnBuy; }
            set { _VnBuy = value; }
        }        

        public string VnSell
        {
            get { return _VnSell; }
            set { _VnSell = value; }
        }

        public string Provider
        {
            get { return _Provider; }
            set { _Provider = value; }
        }

        public string WorldBuy
        {
            get { return _WorldBuy; }
            set { _WorldBuy = value; }
        }

        public string WorldSell
        {
            get { return _WorldSell; }
            set { _WorldSell = value; }
        }

       
        
        public virtual bool wrireToDB()
        {
            return false;
        }

        public virtual void getPrice()
        {
            //return false;
        }

        protected void setNewValue()
        { 
         //if(GoldenPrice.UniqueInstance.flag==true)
            if ((this._VnBuy != "") && (this._VnSell != "") && (this._WorldBuy != "") && (this._WorldSell != ""))
            {
                GoldenPrice.UniqueInstance._WorldBuy = this.WorldBuy;
                GoldenPrice.UniqueInstance._WorldSell = this.WorldSell;
                GoldenPrice.UniqueInstance.VnBuy = this.VnBuy;
                GoldenPrice.UniqueInstance.VnSell = this.VnSell;
                GoldenPrice.UniqueInstance.OilBuy = this.OilBuy;
                GoldenPrice.UniqueInstance.OilSell = this.OilSell;
                GoldenPrice.UniqueInstance.EURUSD = this.EURUSD;
                GoldenPrice.UniqueInstance.GBPUSD = this.GBPUSD;
                GoldenPrice.UniqueInstance.USDJPY = this.USDJPY;
                GoldenPrice.UniqueInstance.USDCAD = this.USDCAD;
                GoldenPrice.UniqueInstance.AUDUSD = this.AUDUSD;
                GoldenPrice.UniqueInstance.NZDUSD = this.NZDUSD;
                GoldenPrice.UniqueInstance.USDNOK = this.USDNOK;
                GoldenPrice.UniqueInstance.flag = true;
            }
        }

        #region Singleton
        static GoldenPrice instance = new GoldenPrice();

        // Public static property to get the object
        public static GoldenPrice UniqueInstance
        {
            get { return instance; }
        }
        #endregion Singleton
    }
}
